package com.bysj.servelt;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bysj.model.Order;
import com.bysj.service.OrderService;

/**
 * Servlet implementation class OrderCommentServlet
 */
@WebServlet("/order_comment")
public class OrderCommentServlet extends HttpServlet {
	private OrderService oService = new OrderService();

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		int orderId = Integer.parseInt(request.getParameter("orderId"));
		Order order = oService.getOrder(orderId);
		request.setAttribute("order", order);
		request.getRequestDispatcher("/comment.jsp").forward(request, response);
	}

}
